/**
 * 
 */
package recognition.engine.nn;

import java.io.File;

import org.encog.Encog;
import org.encog.ml.data.MLDataSet;
import org.encog.neural.networks.BasicNetwork;
import org.encog.persist.EncogDirectoryPersistence;
import org.encog.util.csv.CSVFormat;
import org.encog.util.simple.EncogUtility;
import org.encog.util.simple.TrainingSetUtil;

/**
 * @author Louis
 *
 */
public class Trainer {
	public static void main(String args[]){
		final BasicNetwork network = EncogUtility.simpleFeedForward(100,75,50,10,true);
		final MLDataSet trainingSet = TrainingSetUtil.loadCSVTOMemory(CSVFormat.ENGLISH, "./outputs/CSV/dataset.csv" , false, 100, 10);
		EncogUtility.trainToError(network, trainingSet, 0.001);
		System.out.println();
		System.out.println("Evaluating Network");
		EncogUtility.evaluate(network, trainingSet);
		EncogDirectoryPersistence.saveObject(new File("./outputs/NN/nn.trained"), network);
		Encog.getInstance().shutdown();
	}
}
